/* javascript for templates/views_user_admin/edit.html */

/* 保存 新建/修改 的用户信息*/
function save_user()
{
    // 准备数据
    var user_id = $("#hid-user-id").val();
    var username = $("#txt-username").val();
    var realname = $("#txt-realname").val();
    var email = $("#txt-email").val();
    var telephone = $("#txt-telephone").val();
    var passwd = $("#txt-passwd").val();
    if (passwd != "")
        passwd = MD5(passwd);

    // 保存用户 (ajax请求)
    var req = new Chujue_Request();
    req.url = "/admin/save-user";
    req.send_data = {
        "user_id" : user_id,
        "username": username,
        "realname": realname,
        "passwd"  : passwd,
        "email"   : email,
        "telephone": telephone,
    };
    req.ok_func = function(data) {
        location.href = "/admin/user-list";
    };
    req.ajax_req();
}

